import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

public class shanchu {
    public static void shanchuzhenghang(int n,String dizhi)throws IOException 
    {
        String []p=new String[100];
        int j=0;
        int a=1;
        String fileName = dizhi;
        a=0;
        try (Scanner sl = new Scanner(new FileReader(fileName))) 
        {
            while (sl.hasNextLine()) 
            {  //按行读取字符串
                String lin = sl.nextLine();
                if(j!=n)
                {
                    p[j]=lin;
                    j++;
                }
                else
                {
                }
            }
        }
        catch (Exception e) {
            
        }
        if(a==0)
        {
            try (FileWriter xie = new FileWriter(fileName)) 
            {
                for(int l=1;l<=j;l++) 
                {
                    if(l==n)
                    {
                        //xie.write(shuju+"\n");
                    }
                    else
                    {
                        xie.write(p[l]+"\n");
                    }
                }
            }
        }
    }
}
